<template>
	<view class="content">
		
		<view style="width: 100%;display: flex;padding: 25rpx;">
			<u-search placeholder="查找手机号" :show-action="false" v-model="keyword" @search="search"></u-search>
		</view>
		
		<view v-if="find == 2" style="margin-top: 150rpx;">
			<u-empty text="没有查询到符合的数据" mode="list"></u-empty>
		</view>
		
		<!-- <view style="width: 100%;display: flex;flex-direction: column;margin-top: 60rpx;">
			<view @click="goFriendInfo" style="width: 100%;padding: 25rpx;display: flex;align-items: center;background: #fff;">
				<u-avatar url="/static/logo.png"></u-avatar>
				<view style="display: flex;justify-content: space-between;flex: 1;align-items: center;">
					<view style="display: flex;flex-direction: column;margin-left: 12rpx;">
						<view style="font-size: 30rpx;">
							百鬼夜行
						</view>
						<view style="color: #9c9c9c;font-size: 26rpx;margin-top: 5rpx;">
							18855558888
						</view>
					</view>
					<view class="">
						<u-icon name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data(){
			return {
				keyword:'',
				find:0
			}
		},
		onLoad() {
			
		},
		methods:{
			search:async function(e){
				console.log(e)
				if(e == this.$store.state.user.user.phone){
					return
				}
				
				const ret = await this.$u.post(`bgyx/bgyx/finddata/user`,{phone:e})
				console.log(ret)
				if(ret.success){
					const userlist = this.$store.state.friend.list
					for(let o of userlist){
						if(o.fid == ret.data.id){
							uni.navigateTo({
								url:"/pages/friend/detail?id=" + ret.data.id
							})
							return
						}
					}
					this.goFriendInfo(ret.data)
				}else{
					this.find = 2
				}
			},
			goFriendInfo:function(e){
				uni.navigateTo({
					url:"/pages/friend/friend?id=" + e.id
				})
			}
		}
	}
</script>

<style>
	page{
		background: #fafafa;
	}
</style>

<style scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
	}
	
</style>